package com.hd123.rumba.action;

import java.io.PrintWriter;

import com.hd123.rumba.request.ActionAbstractImpl;
import com.hd123.rumba.request.ActionConstants;
import com.hd123.rumba.request.JspLib;
import com.hd123.rumba.runtime.NamingMgr;

public class SysAdmin extends ActionAbstractImpl {

  public String execute() throws Exception {
    String start = (String)dd.getStartNode();
    PrintWriter o = dd.getResponse().getWriter();
    if ("resetNamingMgr".equals(start)) {
      NamingMgr.getInstance().reset();
      o.print("NamingMgr reset.");
    } else if ("clearTemplateMap".equals(start)){
      JspLib.clearTemplateMap();
      o.print("TemplateMap cleared.");
    } else {
      o.print("Unknow command");
    }
    o.flush();
    return ActionConstants.DIRECT;
  }
}
